home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
diskmags
/
4671-5.790
/
dmg-5373
/
dck
/
control1.doc
< prev
next >
Wrap
Text File
|
1995-10-25
|
14KB
|
408 lines
Welcome to the first proper Control EXTENTION tutorial in SteStosTerone.
I know I teased you all in issue 2, but it is important that you
register Control. This Extention is the only way at present to
combine sprites and hardware scrolling.
So, I will assume that you have the registered version !!!!!
First, a treat !
On this disk you will find a folder called INVADERS.
This folder contains a small invaders game written
by Mr Greenhalgh. LJ was kind enough to supply
the full source and graphics for you to examine.
It doesn't need any other extention ( but Control...)
All the .bas files are compressed using STZIP.PRG which you will find
on this disk.
Read the STZip documentation, and then extract all the files to some blank
disk, or your hard disk.
(You do need Issue 1 and 2 of SteStosTerone , if you can't understand
why this tutorial is here, and why it is important to register the
Control extention.)
***********************************************************************
How to create sprites to use with control.
and what to do with them ?
***********************************************************************
The support files can be found in the folder \CONTROL1
First create some sprites, as usual with the STOS SPRITE Editor
and call the file BALLCUPS.MBK
(make them 64*64 pixels in size)
For the purpose of this tutorial, I suggest you draw a Ball and
a Cup big enough to catch it when it drops from the top of the
screen. That is why I called the sprite bank BALLCUPS.MBK.
The <S> stands for -STOS- <MBK> is the sprite banks name extention
For those who want, there is a ready made file in the folder for you to
examine and edit.
Next load the MAKE.BAS from the Control Extention . I hope you registered!
Otherwise try the PD version that was in issue 1 of SteS.......
I hope that following my advice from previous issues , you have printed
out the manuals, and the tutorials such as the Doc for Maker.bas, and even
this file!. If not, then please do!
Once on the main menu of MAKER.BAS, select 16 images and size 64 for both
values of X and Y
Click on the long < make sprite bank> icon and follow the sreen prompts.
Load BALLCUPS.MBK as Stos sprite bank to be converted, and Save the
resulting file as BALLCUPC.MBK
note : I changed the letter S for C(ontrol)
Again, I also have a ready made file for you, in the folder !
*******************************************************************
Animating sprites Using control
********************************************************************
In the folder you will find : bas1.bas
bas2.bas
bas3.bas
....
.... so you can just load them up and experiment.
But here is the line by line analysis:
BAS1.BAS: Loads and animates a sprite that can be
mouved with the mouse
10 rem ******* (C)1995 JJH *******
20 rem SPRITES USING
30 rem CONTROL EXT.
40 rem ******* (C)1995 JJH *******
50 mode 0 : flash off : key off : hide : fade 1 /set up
60 reserve as screen 10 : IMG=2
70 load "ballcupc.mbk",1 /load image
bank of sprites we
created with the
make program
supplied with
Control
80 load "ballcup.neo",10 / load backgroud
image
90 logic=back
100 turbocopy start(10),physic / copy it to
physic
110 get palette (10)
120 rem ******* (C)1995 JJH *******
130 screen size 320,200 / Tell the new
sprite engine
what the size
of the virtual
screen is.
140 set clip 1,1,319,199 / clipping
coordinates
for sprites
150 turbocopy start(10),logic / Fast Control
command that copies 32k screen.
Here, it is used to update the
entire Logical screen, before a
new sprite is displayed.
160 inc IMG : if IMG>5 then IMG=2 / The sprite images 2,3,4and 5
are the animation frames.
This system loops the
animation.
170 X=x mouse : Y=y mouse /Get mouse coordinates
180 image put logic,X,Y,start(1),IMG,1 / New command displaying
the Control sprites.
Logic, is the destination
x,y, are the coordinates
Start(1), is the address of
the sprite bank
IMG, is the frame to
display
1 Transparent mode
(0 would be solid)
190 screen swap : wait vbl / As usual
200 if fire then wait 10 : default : end / exit if mouse click
210 goto 150
********* New Commands :
SCREEN SIZE x,y
use 320,200 unless
using hardware scrolling.
TURBOCOPY Sourceaddress, Destaddress
Copies 32K of screen data
from source address to destination
IMAGE PUT destadd,dx,dy,Souradd,Frame, mode
Displays a sprite on the screen
destadd, at coordinates dx,dy.
Souradd is the sprite banks address
and usually Start(1)
Frame is the sprite image to be
displayed
Mode can be 0 or 1. Mostly use
1 if the sprites must be transparent
and merged onto the background. 0 is
faster.
********************
BAS2.BAS
********************
Same as above , but combining the sprite with hardware scrolling.
100 rem ******* (C)1995 JJH *******
200 rem SPRITES USING
300 rem CONTROL EXT.
400 rem ******* (C)1995 JJH *******
500 mode 0 : flash off : key off : hide : fade 1
600 reserve as screen 10 : IMG=2
700 reserve as work 11,64000
800 load "ballcupc.mbk",1
900 load "ballcup.neo",10
1000 copy start(10),start(10)+32000 to start(11)
1100 copy start(10),start(10)+32000 to start(11)+32000
/We build a screen bank
320*400 in size
1200 bcopy 11 to 12
1300 bcopy 11 to 13
/ We make two copies of this Virtual screen bank
1400 logic=back
1500 turbocopy start(10),physic
1600 get palette (10)
1700 rem ******* (C)1995 JJH *******
1800 screen size 320,400 : hard screen size 320,400,0
/We tell the Control extention and
the STE extention the virtual screen size
1900 set clip 1,1,320,400 / Control's clipping zone
1905 Q=hard physic(start(13)) : hard inter on : y mouse=0
/ Tell the STE extention where
our Virtual Physical screen is
and starts the hardware interupt.
We also place the mouse at the top of
the screen
2000 LO1=start(11) : LO2=start(12) : PHY=start(13)
/ Give names to virtual screen
banks
LO1 is logical
LO2 holds a backround copy
PHY is used as physical
2100 inc IMG : if IMG>5 then IMG=2 / sprite animation frame
calculated
2200 X=x mouse : Y=y mouse*4 / mouse coordinates
2201 if Y>400 then Y=400 / Limit mouse mouvement
2300 image put LO1,X,Y,start(1),IMG,1 / Display sprite
2450 YY=Y/2 : if YY>200 then Y=200
2451 if YY>200 then Y=200 / Calculate the y Offset value
for the STE extention. Refer to
issue 2 of SteStosTerone for
details
2500 if fire then wait 10 : default : hard inter off : end
2550 hard screen offset 0,YY / tell STE extention which part
of the virtual screen to
start showing from
2555 Q=hard physic(PHY) / Tell STE extention where the
virtual screenbank is
2560 wait vbl : swap PHY,LO1 / Swap our logical and physical
Pseudo screen addresses.
2600 goto 2100
*******
When yo run this program, you will notice
that we now have a hardware scolling
background , but that the sprite's background is
not updated automaticaly. Rather than updating the
full screen as in the first example , we will
only update the area of the sprite, saving a lot of
time.
This is what happens in :
*************
BAS3.BAS
*************
10 rem ******* (C)1995 JJH *******
20 rem SPRITES USING
30 rem CONTROL EXT.
40 rem ******* (C)1995 JJH *******
45 rem*
50 rem* mouse controled
54 rem*
60 rem ******* (C)1995 JJH *******
70 mode 0 : flash off : key off : hide : fade 1
80 reserve as screen 10 : IMG=2
90 reserve as work 11,64000
100 load "ballcupc.mbk",1
110 load "ballcup.neo",10
120 copy start(10),start(10)+32000 to start(11)
130 copy start(10),start(10)+32000 to start(11)+32000
140 bcopy 11 to 12
150 bcopy 11 to 13
160 logic=back
170 turbocopy start(10),physic
180 get palette (10)
190 rem ******* (C)1995 JJH *******
200 screen size 320,400 : hard screen size 320,400,0
210 set clip 0,0,320,400
220 Q=hard physic(start(13)) : hard inter on : y mouse=0
230 LO1=start(11) : LO2=start(12) : PHY=start(13)
240 inc IMG : if IMG>10 then IMG=4 / I changed this to slow down
the animations frame rate
( check line 290 )
250 OLDX=X : OLDY=Y / I save the old
sprite coordinates,
as that is the area that will
need restoring
260 X=x mouse : Y=y mouse*4
270 if Y>360 then Y=360
280 if Y<64 then Y=64
290 IM=IMG/2 : image put LO1,X,Y,start(1),IM,1
/ Display the new sprite
300 YY=Y/2 : if YY>200 then Y=200
310 if YY>200 then Y=200
320 if fire then wait 10 : default : hard inter off : end
330 hard screen offset 0,YY
340 Q=hard physic(LO1)
350 wait vbl : swap PHY,LO1
360 bigcopy LO2,OLDX,OLDY,OLDX+48,OLDY+32,LO1,OLDX,OLDY
/ Erase the old Sprite
We use LO2 as source,
and copy onto LO1
370 goto 240
***** NEW COMMAND
BIG COPY source add, x1,y1,x2,y2,destination add,x,y
Source add, /Our Background address
X1,Y1 /Coordinates of top left corner
X2,Y2 / .. bottom right ..
Destination add /Logical screen address as
destination
X,Y /Top left corner coordinates of
destination
Seriously, load the source code in STOS. Experiment, and
build on the examples. These 3 programs are designed to let you
get familiar with the principals.
Once you feel more confident , build a 640*200 screen
and use horizontal hardware scrolling.
Be sure to set the screen sizes and clipping areaes.